<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>

    function Cat(name, color, type) {
        // 实例化对象的属性/方法
        this.name = name;
        this.color = color;
        this.type = type;

    }
    // console.dir(Cat);

    // 构造函数的静态属性和方法 => 自己用
    Cat.hello = "hello Cat";
    Cat.isCat = function (arg) {
        if (arg.constructor === Cat) {
            return true;
        }
        return false;
    }


    // 原型对象(动态方法 => 给实例化对象用)
    // Cat.prototype = {constructor}
    Cat.prototype.species = "Cat";
    Cat.prototype.skill = function () {
        console.log("捉老鼠");
    };
    Cat.prototype.call = function () {
        console.log("喵喵");
    };
    Cat.prototype.say = function () {
        // this -> 调用此方法的实例化对象
        console.log(this.name, this.color);
    };

    console.dir(Cat)

    var Tom = new Cat("Tom", "black", "田园");
    console.log(Tom);
    console.log(Cat.isCat(Tom)); 
</script>

</html>